

import type { Isystemnotification } from './entity';
import type { IPageParams } from '@/types/table'
import request from '@/api/request'

export function getPageList(params: IPageParams) {
  return request({
    url: `admin/system/notification/list`,
    method: 'get',
    params,
    loading: true
  }).then(list => { return { list } })
}

export function systemnotificationDel(data) {
  return request({
    url: `admin/system/notification/delete`,
    method: 'post',
    data
  })
}
export function systemnotificationinfo(params) {
  return request({
    url: `/admin/system/notification/detail`,
    method: 'get',
    params
  })
}


export function systemnotificationAddup(data) {
  return request({
    url: `admin/system/notification/${!data.id ? 'save' : 'update'}`,
    method: 'post',
    data
  })
}
/**
 * 小程序订阅模板开关
 * @param pram
 */
export function notificationRoutine(id) {
  return request({
    url: `/admin/system/notification/routine/switch/${id}`,
    method: 'post',
  })
}

/**
 * 公众号模板开关
 * @param pram
 */
export function notificationWechat(id) {
  return request({
    url: `/admin/system/notification/wechat/switch/${id}`,
    method: 'post',
  })
}
/**
 * 发送短信开关
 * @param pram
 */
export function notificationSms(id) {
  return request({
    url: `/admin/system/notification/sms/switch/${id}`,
    method: 'post',
  })
}